/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#ifndef __PQ_EventManager_H__
#define __PQ_EventManager_H__

#include "EnginePrerequisites.h"
#include "GameEventListener.h"

#include "GameObject.h"
#include "TerrainGroupObject.h"

namespace PQEngine
{
	typedef std::vector<GameEventListener*> GEventListenerVector;

	/*This class is the base of the PQEngine event system.
	We will build our event system base on this class.
	*/
	class GameEventManager
	{
	public:
		static GameEventManager& getSingleton();
		void removeNullPlaceHolder();

		void addListener(GameEventListener* listener);
		void removeListener(GameEventListener* listener);

		void OnRenderSettingSelected();

		void OnTerrainObjectCreated(TerrainObject* object);
		void OnTerrainObjectSelected(TerrainObject* object);
		void OnTerrainGroupCreated(TerrainGroupObject* object);
		void OnTerrainGroupSelected(TerrainGroupObject* object);

		void OnCreateObject(ObjectType type,int x,int y);
		void OnAddResource(std::string path,int x,int y);//add resouce to mouse point selected gameobject

		void OnCreateComponet(GameObject *obj,Component* componet);
		void OnAddComponet(GameObject *obj,Component* componet);
		void OnAddChildGameObject(GameObject *parent,GameObject *child);
		void OnRemoveChildGameObject(GameObject *parent,GameObject *child);
		void OnGameObjectSelected(GameObject *object);
		void OnTranslateObject(GameObject *object);
		void OnRotateObject(GameObject *object);
		void OnScaleObject(GameObject *object);
	private:
		GEventListenerVector _listeners;
		GameEventManager();
		bool _listenerRun;
	};
}
#endif
